package com.assets.newNHF;

import android.app.Application;
import android.content.Context;

import com.assets.newNHF.helper.SoundPoolHelper;
import com.assets.newNHF.util.PowerUtil;
import com.assets.newNHF.util.SpUtils;

import cat.ereza.customactivityoncrash.activity.DefaultErrorActivity;
import cat.ereza.customactivityoncrash.config.CaocConfig;

/**
 * Created by Administrator on 2018/3/27.
 */

public class UhfApplication extends Application {
    private static Context instance;

    @Override
    public void onCreate() {
        super.onCreate();
        instance = getApplicationContext();
        SoundPoolHelper.getInstance(this);
        PowerUtil.power("1");
        SpUtils.getInstance().init(getApplicationContext());
        com.assets.util.SpUtils.getInstance().init(getApplicationContext());
        CaocConfig.Builder.create()
                .backgroundMode(CaocConfig.BACKGROUND_MODE_SILENT)
                .enabled(true)//这阻止了对崩溃的拦截,false表示阻止。用它来禁用customactivityoncrash框架
                .minTimeBetweenCrashesMs(2000)      //定义应用程序崩溃之间的最短时间，以确定我们不在崩溃循环中。比如：在规定的时间内再次崩溃，框架将不处理，让系统处理！
                .errorActivity(DefaultErrorActivity.class) //程序崩溃后显示的页面

                .apply();

    }

    public static Context getInstance() {
        return instance;
    }
}
